//package com.gwall.drools.config;
//
//import org.kie.api.KieServices;
//import org.kie.api.builder.*;
//import org.kie.api.runtime.KieContainer;
//import org.kie.internal.io.ResourceFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * 规则引擎配置类
// */
//@Configuration
//public class DroolsConfig {
//
//    private static final KieServices kieServices = KieServices.Factory.get();
//    //制定规则文件的路径
//    private static final String RULES_CUSTOMER_RULES_DRL = "rules/order.drl";
//
//    @Bean
//    public KieContainer kieContainer() {
//        //获得Kie容器对象
//        KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
//        kieFileSystem.write(ResourceFactory.newClassPathResource(RULES_CUSTOMER_RULES_DRL));
//
//        KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
//        kieBuilder.buildAll();
//
//        KieModule kieModule = kieBuilder.getKieModule();
//        KieContainer kieContainer = kieServices.newKieContainer(kieModule.getReleaseId());
//
//        return kieContainer;
//    }
//
//}
//
